package com.zhuoyue.web.controller.system;

import com.zhuoyue.common.core.controller.BaseController;
import com.zhuoyue.common.core.domain.AjaxResult;
import com.zhuoyue.common.core.page.TableDataInfo;
import com.zhuoyue.common.utils.poi.ExcelUtil;
import com.zhuoyue.system.domain.po.SceneBindingPo;
import com.zhuoyue.system.domain.vo.SceneBindingVo;
import com.zhuoyue.system.service.ITblSceneBindingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhanghui
 * @date 2021/9/26 9:59
 */
@RestController
@RequestMapping("/system/sceneBinding")
public class SceneBindingController extends BaseController {
    @Autowired
    private ITblSceneBindingService sceneBindingService;

    @GetMapping("/list")
    public TableDataInfo list(SceneBindingPo sceneBindingPo) {
        startPage();
        List<SceneBindingVo> list = sceneBindingService.listSceneBinding(sceneBindingPo);
        return getDataTable(list);
    }

    @GetMapping("/export")
    public AjaxResult export(SceneBindingPo sceneBindingPo) {
        List<SceneBindingVo> list = sceneBindingService.listSceneBinding(sceneBindingPo);
        ExcelUtil<SceneBindingVo> util = new ExcelUtil<>(SceneBindingVo.class);
        return util.exportExcel(list, "场景绑定");
    }
}
